<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends CI_Controller {

	
	public function index()
	{
		// $this->load->database();

		// $this->db->where("sex","男");

		// $this->db->select('sex,kiss');

		// $this->db->order_by('kiss', 'asc');

		// $res = $this->db->get('fly_user')->result();

		// var_dump($res);

		// $query = $this->db->query('SELECT * FROM fly_user');

		// foreach ($query->result() as $row)
		// {
		//     var_dump($row);
		// }

		// echo 'Total Results: ' . $query->num_rows();
		// echo "index/index";
		// 
		$this->load->model('User_model');

        $data = $this->User_model->get_hot_user();

        var_dump($data);
	}

	public function code()
	{
		$this->load->helper('captcha');

		$vals = array(
	    'word'      => 'dsfhsjdf',
	    'img_path'  => './captcha/',
	    'img_url'   => 'http://127.0.0.1/p201804/ci/captcha/',
	    'font_path' => './path/to/fonts/texb.ttf',
	    'img_width' => '150',
	    'img_height'    => 30,
	    'expiration'    => 7200,
	    'word_length'   => 8,
	    'font_size' => 16,
	    'img_id'    => 'Imageid',
	    'pool'      => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',

	    // White background and border, black text and red grid
	    'colors'    => array(
	        'background' => array(255, 255, 255),
	        'border' => array(255, 255, 255),
	        'text' => array(0, 0, 0),
	        'grid' => array(255, 40, 40)
	    )
	);

	$cap = create_captcha($vals);
	echo($cap['image']);
	}
}
